package org.destiny.account.richclient.form;

import javax.swing.JComponent;

import org.destiny.account.entity.Customer;
import org.destiny.account.richclient.binding.RadioGroupBinding;
import org.springframework.richclient.form.AbstractForm;
import org.springframework.richclient.form.builder.TableFormBuilder;

public class CustomerForm extends AbstractForm {

	public CustomerForm(Customer customer) {
		super(customer);
		// RulesValidator validator = new RulesValidator(getFormModel());
		// validator.setRulesContextId("rulesSource");
		// getFormModel().setValidator(validator);
		// System.out.println("name:"+((Customer)getFormObject()).getName());
		this.setId("customerFomr");
	}

	@Override
	protected JComponent createFormControl() {
		String s = org.springframework.richclient.command.support.GlobalCommandIds.SAVE_AS;
		TableFormBuilder builder = new TableFormBuilder(getBindingFactory());
		builder.add("name");
		builder.row();
		builder.add(new RadioGroupBinding(getFormModel(), "gender"));
		builder.row();
		builder.add("township");
		builder.row();
		builder.add("village");
		builder.row();
		builder.addTextArea("remark");
		return builder.getForm();
	}

}
